package com.bwf.lgqingdan.utils;

import android.content.Context;
import android.content.Intent;

import com.bwf.lgqingdan.gui.activity.AllCategoryActivity;
import com.bwf.lgqingdan.gui.activity.AllTagsActivity;
import com.bwf.lgqingdan.gui.activity.ArticleDetailActivity;
import com.bwf.lgqingdan.gui.activity.ArticleListActivity;
import com.bwf.lgqingdan.gui.activity.BuyActivity;
import com.bwf.lgqingdan.gui.activity.BuyLinksActivity;
import com.bwf.lgqingdan.gui.activity.CategoryThingActivity;
import com.bwf.lgqingdan.gui.activity.CollectionDetailActivity;
import com.bwf.lgqingdan.gui.activity.HotTagsActivity;
import com.bwf.lgqingdan.gui.activity.MainActivity;
import com.bwf.lgqingdan.gui.activity.RelatedThingActivity;
import com.bwf.lgqingdan.gui.activity.ReputationThingActivity;
import com.bwf.lgqingdan.gui.activity.ReputationsListActivity;
import com.bwf.lgqingdan.gui.activity.SearchActivity;
import com.bwf.lgqingdan.gui.activity.SearchResultActivity;
import com.bwf.lgqingdan.gui.activity.SplashActivity;
import com.bwf.lgqingdan.gui.activity.ThingDescribeActivity;
import com.bwf.lgqingdan.gui.activity.ThingDetailActivity;

/**
 * Created by Administrator on 2016/11/17.
 * 跳转的工具类
 */

public class IntentUtils {
    /**
     * 跳转到文章详情
     * @param context
     * @param articleId 文章id
     */
    public static final void gotoArticleDetailActivity(Context context,int articleId){
        Intent intent = new Intent(context,ArticleDetailActivity.class);
        intent.putExtra(ArticleDetailActivity.ARTICLE_ID,articleId);
        context.startActivity(intent);
    }

    /**
     * 跳转到文章列表
     * @param context
     * @param categoryId 分类id
     */
    public static void gotoArticleListActivity(Context context,int categoryId) {
        Intent intent = new Intent(context,ArticleListActivity.class);
        intent.putExtra(ArticleListActivity.TAG_CATEGORY_ID,categoryId);
        context.startActivity(intent);
    }

    /**
     * 跳转到所有标签
     * @param context
     */
    public static void gotoAllTagsActivity(Context context) {
        Intent intent = new Intent(context,AllTagsActivity.class);
        context.startActivity(intent);
    }

    /**
     * 跳转到分类商品
     * @param context
     * @param tag_id
     * @param title
     */
    public static void gotoCategoryThingActivity(Context context, int tag_id, String title) {
        Intent intent = new Intent(context, CategoryThingActivity.class);
        intent.putExtra(CategoryThingActivity.TAG_CATEGORY_ID,tag_id);
        intent.putExtra(CategoryThingActivity.TAG_CATEGORY_NAME,title);
        context.startActivity(intent);
    }

    /**
     * 跳转到热门标签
     * @param context
     */
    public static void gotoHotTagsActivity(Context context) {
        Intent intent = new Intent(context, HotTagsActivity.class);
        context.startActivity(intent);
    }

    /**
     * 跳转到口碑商品列表
     * @param context
     * @param rankingId
     * @param rankingTitle
     */
    public static void gotoReputationThingActivity(Context context, int rankingId, String rankingTitle) {
        Intent intent = new Intent(context, ReputationThingActivity.class);
        intent.putExtra(ReputationThingActivity.RANKING_ID, rankingId);
        intent.putExtra(ReputationThingActivity.RANKING_TITLE, rankingTitle);
        context.startActivity(intent);
    }

    /**
     * 跳转到商品详情
     * @param context
     * @param thingId
     */
    public static void gotoThingDetailActivity(Context context, int thingId, boolean detailFromNetwork) {
        Intent intent = new Intent(context, ThingDetailActivity.class);
        intent.putExtra(ThingDetailActivity.THING_ID, thingId);
            intent.putExtra(ThingDetailActivity.TAG_DETAIL_FROM_NETWORK,detailFromNetwork);
        context.startActivity(intent);
    }

    /**
     * 跳转到专题详情
     * @param context
     * @param collectionId
     */
    public static void gotoCollectionDetailActivity(Context context,int collectionId) {
        Intent intent = new Intent(context, CollectionDetailActivity.class);
        intent.putExtra(CollectionDetailActivity.COLLECTION_ID,collectionId);
        context.startActivity(intent);
    }

    /**
     * 跳转到所有分类
     * @param context
     */
    public static void gotoAllCategoryActivity(Context context) {
        context.startActivity(new Intent(context, AllCategoryActivity.class));
    }

    /**
     * 跳转到商品描述
     * @param context
     * @param html
     */
    public static void gotoThingDescribeActivity(Context context, String html) {
        Intent intent = new Intent(context,ThingDescribeActivity.class);
        intent.putExtra(ThingDescribeActivity.HTML_URL,html);
        context.startActivity(intent);
    }

    /**
     * 跳转到口碑清单
     * @param context
     */
    public static void gotoReputationsListActivity(Context context) {
        Intent intent = new Intent(context, ReputationsListActivity.class);
        context.startActivity(intent);
    }

    /**
     * 跳转到相关商品
     * @param context
     * @param articleId
     */
    public static void gotoRelatedThingActivity(Context context, int articleId) {
        Intent intent = new Intent(context,RelatedThingActivity.class);
        intent.putExtra(RelatedThingActivity.ARTICLE_ID,articleId);
        context.startActivity(intent);
    }

    /**
     * 跳转到引导界面
     * @param context
     */
    public static void gotoSplashActivity(Context context) {
        context.startActivity(new Intent(context,SplashActivity.class));
    }

    /**
     * 跳转到主界面
     * @param context
     */
    public static void gotoMainActivity(Context context) {
        context.startActivity(new Intent(context,MainActivity.class));
    }

    /**
     * 跳转到 购买渠道
     * @param context
     * @param thingId
     */
    public static void gotoBuyLinksActivity(Context context, int thingId) {
        Intent intent = new Intent(context,BuyLinksActivity.class);
        intent.putExtra(BuyLinksActivity.THING_ID,thingId);
        context.startActivity(intent);
    }

    /**
     * 跳转到商品购买界面
     * @param context
     * @param link
     */
    public static void gotoBuyActivity(Context context, String link) {
        Intent intent = new Intent(context,BuyActivity.class);
        intent.putExtra(BuyActivity.URL,link);
        context.startActivity(intent);
    }
    /**跳转到搜索界面**/
    public static void gotoSearchActivity(Context context) {
        Intent intent = new Intent(context, SearchActivity.class);
        context.startActivity(intent);
    }

    /**
     * 跳转到搜索结果界面
     * @param context
     */
    public static void gotoSearchResultActivity(Context context,String keyword) {
        Intent intent = new Intent(context, SearchResultActivity.class);
        intent.putExtra(SearchResultActivity.TAG_KEYWORD,keyword);
        context.startActivity(intent);
    }
    /**
     * 跳转到反馈界面
     * @param context
     */
    public static void gotoFeedbackActivity(Context context) {
    }
}
